<template>
  <div
    class="diy-single"
    :style="[
      `padding:${diyItem.style.mt}px ${diyItem.style.mr}px ${diyItem.style.mb}px ${diyItem.style.ml}px `,
    ]"
  >
    <div
      class="item-image"
      :class="diyItem.style.shade == 1 ? 'style-shade' : ''"
      :style="[
        `padding:${diyItem.style.pt}px ${diyItem.style.pr}px ${diyItem.style.pb}px ${diyItem.style.pl}px `,
        `background:${
          diyItem.style.bg_status == 1 ? diyItem.style.bg : 'none'
        }`,
        `border-radius:${diyItem.style.t_radius}px ${diyItem.style.t_radius}px ${diyItem.style.b_radius}px ${diyItem.style.b_radius}px`,
      ]"
    >
      <img
        :src="diyItem.img || $utils.staticImgPath('diy/banner.png', 'static')"
        :style="{ borderRadius: diyItem.style.radius + 'px' }"
      />
    </div>
  </div>
</template>
  
  <script lang="ts">
export default {
  name: "storeDiyPreviewSingle",
};
</script>
  <script  lang="ts" setup >
import { ref, getCurrentInstance } from "vue";
import { diySingleDataType } from "@/types";

const {
  proxy: { $utils },
} = getCurrentInstance() as any;

const props = withDefaults(
  defineProps<{
    diyItem: diySingleDataType;
    index: number | string;
  }>(),
  {
    diyItem: () => {
      return {
        style: {
          radius: 0,
          bg_status: 0,
          bg: "#FFFFFF",
          shade: 0,
          mt: 0,
          mb: 0,
          ml: 0,
          mr: 0,
          pt: 0,
          pb: 0,
          pl: 0,
          pr: 0,
          t_radius: 0,
          b_radius: 0,
        },
        img: "",
        link: {},
      };
    },
    index: 0,
  }
);
</script>

  <style scoped>
/*单图*/
.diy-single img {
  width: 100%;
  display: block;
}
</style>